package com.cq.androidtools.room1

import androidx.room.*

/**
 * 作者: CQ
 * 日期: 2021-05-11
 * 说明:
 */
@Dao
interface StudentDao {
    @Query("SELECT * FROM Student")
    fun getAll() : List<Student>

    @Query("SELECT * FROM Student WHERE sId IN (:userIds)")
    fun loadAllByIds(userIds : IntArray): List<Student>

    @Query("SELECT * FROM Student WHERE age=:age")
    fun getStudentByAge( age : Int): List<Student>

    @Query("SELECT * FROM Student WHERE age=:age LIMIT :max")
    fun getStudentByAge(max:Int , age:IntArray ):List<Student>

    @Query("SELECT * FROM Student WHERE sId =:sId")
    fun getStudent(sId:Int ): Student

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insert(student : Student)

    @Update
    fun updateStudent( student : Student)

    @Delete
    fun delete(student : Student)

}